Skip to content

fix(stake): gasless deposit follow-ups before the flag goes on - #1568

Draft
DealAppSeo wants to merge 1 commit into
mainfrom
claude/r3b-gasless-followups-v2
Draft

DealAppSeo wants to merge 1 commit into
mainfrom
claude/r3b-gasless-followups-v2

Conversation

@DealAppSeo

Copy link
Copy Markdown
Owner

Owner action

You merge (MAJOR: money path). This replaces #1564, which conflicted with main once #1558 squash-merged. The guard blocks merging main into a branch, so the same commit was cherry-picked onto main (identical diff; 62/62 gasless and refunder tests pass on it). One decision is needed from you, item 4 below. Nothing here turns the flag on; GASLESS_DEPOSIT_MODE stays off by default.

What this is

These are follow-ups for #1558 from an independent review, to fix before GASLESS_DEPOSIT_MODE=on. #1558 is now merged as 95d60b34; none of these is on main yet.

  1. A failed relay re-reads authorizationState before it says "no USDC moved". Anyone can submit a signed authorization, and its to is the escrow, so a revert can mean another submitter used it and the USDC moved.
    • used (or canceled) → 202 authorization_used_elsewhere
    • unreadable → 202 send_not_checked
    • only an unused authorization → 502 not_sent
  2. Chain id. verifyEip3009Local takes the EIP-712 chainId from NETWORK (getActiveNetwork), but the escrow sends only on Base Sepolia (84532). A server with NETWORK set to another chain, or to an unknown name, now refuses with 503 wrong_network before any chain read.
  3. The route catch-all (src/routes/v1.ts) answers a fixed message. The error text goes to the log only. ethers puts the RPC URL, and any key in it, in its messages.
  4. Decision for you: the global 4/min admission budget can be griefed. Four wallets, each with an account and 1 USDC, can hold every slot each minute and keep everyone else at 429. The escrow pays all the gas, and the griefers' USDC comes back by withdrawal. The per-payer slot only stops one wallet. This PR states it as a ponytail: ceiling in createGaslessAdmission and does not pick a fix. The options are to gate admission on something a rotated wallet cannot make for free (account age, a stake already held, a signed connect), or to charge the gas back from the deposit.
  5. escrow-refunder.ts header now names all three kinds of send on the escrow's one queue: refunds, gasless relays and agent payouts.

Evidence

  • E:\dev\reports\2026-11-16\r-loop\r3b.test-output-head.txt: 46/46 pass across the gasless, route, auth-bypass and relay suites.
  • r3b.test-output-old-src.txt: the new tests against feat(stake): gasless owner deposit via USDC EIP-3009, default off (R3) #1558's gasless-deposit.ts and v1.ts at 64e02092. 4 fail: used-elsewhere, re-read-fails, wrong-network and route catch-all. The still-unused → 502 control passes on both.
  • tsc --noEmit is clean.

Not merged by Claude. Strix and the fenced Grok review have not run on this PR yet.

🤖 Generated with Claude Code

- A relay that fails re-reads authorizationState: used (or canceled) answers 202
  authorization_used_elsewhere, an unreadable state answers 202 send_not_checked, and only an
  unused one answers 502 "no USDC moved". A signed authorization can be submitted by anyone and
  pays the escrow, so a revert can mean the USDC did move.
- Refuse with 503 wrong_network unless NETWORK resolves to Base Sepolia: verifyEip3009Local takes
  the EIP-712 chainId from NETWORK while the escrow sends only on 84532.
- The route's catch-all answers a fixed message; the error text goes to the log.
- The global 4/min admission budget can be griefed by four funded wallets: stated as a ponytail
  ceiling with the upgrade options (a decision, not decided here).
- escrow-refunder.ts header names all three kinds of send on the escrow's one queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DealAppSeo DealAppSeo added the grok-review Ask the grok-review loop to review this PR (also drafts) label Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grok-review Ask the grok-review loop to review this PR (also drafts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant